//
//  FatCollectionViewCell.m
//  Taste
//
//  Created by 徐昊 on 16/8/31.
//  Copyright © 2016年 徐昊. All rights reserved.
//

#import "FatCollectionViewCell.h"
#import "Content.h"
#import "NSString+Vali.h"
#import "UIImageView+WebCache.h"
#import "VideoRes.h"

@interface FatCollectionViewCell ()
@property (weak, nonatomic) IBOutlet UIImageView *picture;



@property (weak, nonatomic) IBOutlet UIImageView *video;

@end

@implementation FatCollectionViewCell

- (void)setContent:(Content *)content {
    _content = content;
    
    [self.picture sd_setImageWithURL:[NSURL URLWithString:[NSString imageWebWithStr:_content.pic]] placeholderImage:[UIImage imageNamed:@"IMG_Universal_Placeholder"] completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, NSURL *imageURL) {
    }];
    self.label.text = _content.title;
    if ([_content.video isKindOfClass:[NSString class]]) {
        
    } else {
        if ([_content.video isEqual:@(1)]) {
            self.video.alpha = 1;
        } else {
            self.video.alpha = 0;
        }
    }
}
- (void)setRes:(VideoRes *)res {
    _res = res;
    [self.picture sd_setImageWithURL:[NSURL URLWithString:[NSString imageWebWithStr:_res.pic]] placeholderImage:[UIImage imageNamed:@"IMG_Universal_Placeholder"] completed:^(UIImage *image, NSError *error, SDImageCacheType cacheType, NSURL *imageURL) {
    }];
    self.label.text = _res.title;
}
- (void)awakeFromNib {
    // Initialization code
    [super awakeFromNib];
}

@end
